Skip to content

Conversation

duynguyenxa
Copy link
Member

This PR add support for SCI I2C driver on RA devices

Copy link
Member

@dsseng dsseng left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit

sci2_default: sci2_default {
group1 {
/* sda scl */
psels = <RA_PSEL(RA_PSEL_SCI_2, 1, 12)>,<RA_PSEL(RA_PSEL_SCI_2, 1, 13)>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should follow the file style

Suggested change
psels = <RA_PSEL(RA_PSEL_SCI_2, 1, 12)>,<RA_PSEL(RA_PSEL_SCI_2, 1, 13)>;
psels = <RA_PSEL(RA_PSEL_SCI_2, 1, 12)>,
<RA_PSEL(RA_PSEL_SCI_2, 1, 13)>;

sci2_default: sci2_default {
group1 {
/* sda scl */
psels = <RA_PSEL(RA_PSEL_SCI_2, 1, 12)>,<RA_PSEL(RA_PSEL_SCI_2, 1, 13)>;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
psels = <RA_PSEL(RA_PSEL_SCI_2, 1, 12)>,<RA_PSEL(RA_PSEL_SCI_2, 1, 13)>;
psels = <RA_PSEL(RA_PSEL_SCI_2, 1, 12)>,
<RA_PSEL(RA_PSEL_SCI_2, 1, 13)>;

@duynguyenxa duynguyenxa force-pushed the support_renesas_ra_i2c_sci branch from 5cde92d to 3fa6d4b Compare September 29, 2025 06:36
@zephyrbot zephyrbot added area: Boards/SoCs area: Tests Issues related to a particular existing or missing test area: Devicetree Bindings labels Sep 29, 2025
@zephyrbot zephyrbot requested a review from nashif September 29, 2025 06:37
@duynguyenxa duynguyenxa force-pushed the support_renesas_ra_i2c_sci branch from 3fa6d4b to 3ec8211 Compare September 29, 2025 06:48
Comment on lines +24 to +25
if I2C_RENESAS_RA_SCI
config I2C_RENESAS_RA_SCI_DTC
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Better to add a blank line between if * and the following code


#define I2C_MAX_MSG_LEN (1 << (sizeof(uint8_t) * 8))

typedef void (*init_func_t)(const struct device *dev);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This typedef is not used anywhere. It should be removed

Comment on lines +107 to +108
R_SCI_I2C_Close(&data->ctrl);
R_SCI_I2C_Open(&data->ctrl, &data->i2c_config);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The error code should be checked

Comment on lines +118 to +120
struct sci_i2c_data *data = (struct sci_i2c_data *const)dev->data;
*dev_config = data->dev_config;
return 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a blank line after the variable declaration.


/* Set destination address with configured address mode before sending msg. */

i2c_master_addr_mode_t addr_mode = 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable declaration should be moved to the top of the code block. The initial value does not need to be assigned.

struct sci_i2c_data *data = dev->data;
fsp_err_t fsp_err;
struct i2c_msg *current, *next;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The blank line should be removed

void *p_context)
{
struct sci_i2c_data *data = dev->data;

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This blank line should be removed

fsp_err_t fsp_err;
int ret;

data->dev_config |= I2C_MODE_CONTROLLER;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Shoud it be = instead of |=?

Comment on lines +10 to +11
properties:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
properties:
properties:

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need to re-run clang-format for this file

@thenguyenyf
Copy link
Contributor

You will need to rebase to pass this job.
https://github.com/zephyrproject-rtos/zephyr/actions/runs/18088368313/job/51463326829?pr=96558

First commit to add support for Renesas RA i2c sci driver

Signed-off-by: Khai Cao <[email protected]>
Add I2C device nodes for the SCI peripheral on RA6 series

Signed-off-by: Khai Cao <[email protected]>
Add I2C device nodes for the SCI peripheral on RA4 series

Signed-off-by: Khai Cao <[email protected]>
Add I2C device nodes for the SCI peripheral on RA2 series

Signed-off-by: Khai Cao <[email protected]>
Enable support of i2c sci driver on these boards: ek_ra6m5,
ek_ra6m4

Signed-off-by: Khai Cao <[email protected]>
Add board support for EK_RA6M5, EK_RA6M4 i2c test use sci_i2c:
- tests/drivers/i2c/i2c_api

Example for i2c use sci_i2c:

west build -b ek_ra6m5 tests/drivers/i2c/i2c_api/ -p always \
 -DDTC_OVERLAY_FILE=boards/ek_ra6m5_sci_i2c.overlay \
 -DCONF_FILE="boards/ek_ra6m5_sci_i2c.conf"

Signed-off-by: Khai Cao <[email protected]>
@duynguyenxa duynguyenxa force-pushed the support_renesas_ra_i2c_sci branch from 3ec8211 to b737861 Compare October 6, 2025 13:44
Copy link

sonarqubecloud bot commented Oct 6, 2025

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Boards/SoCs area: Devicetree Bindings area: I2C area: Tests Issues related to a particular existing or missing test platform: Renesas RA Renesas Electronics Corporation, RA
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants